#ifndef __LIBRAWSOCKET_H__
#define __LIBRAWSOCKET_H__
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <string>
#include <unistd.h>


class RawSocket
{
private:
    struct sockaddr_in mRemoteAddr;
    struct ifreq mInterface;
    int mDomain;

public:
    int socket(int domain, int type, int protocol);
    int bind(int sockfd, const struct sockaddr *addr,socklen_t addrlen);
    int getsockopt(int sockfd, int level, int optname,void *optval, socklen_t *optlen);
    int setsockopt(int sockfd, int level, int optname,const void *optval, socklen_t optlen);
    int connect(int sockfd, const struct sockaddr *addr,socklen_t addrlen);
    ssize_t send(int sockfd, const void *buf, size_t len, int flags);
    ssize_t sendto(int sockfd, const void *buf, size_t len, int flags,const struct sockaddr *dest_addr, socklen_t addrlen);
    ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
    ssize_t recv(int sockfd, void *buf, size_t len, int flags);
    ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags,struct sockaddr *src_addr, socklen_t *addrlen);
    ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
    int close(int fd);

    RawSocket(std::string interface, std::string remote_ip, int port);
    RawSocket();
    ~RawSocket();
   
};


#endif // __LIBRAWSOCKET_H__
